//
//  FBProfileCell.m
//  Friendsback
//
//  Created by 宋质彬 on 2018/3/5.
//  Copyright © 2018年 宋质彬. All rights reserved.
//

#import "FBProfileCell.h"

@interface FBProfileCell ()
@property (nonatomic , weak) UILabel *namelab;
@property (nonatomic , weak) UIImageView *arrowImage;
@property (nonatomic , weak) UIImageView *imageIcon;
@end

@implementation FBProfileCell

#pragma mark - init
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor whiteColor];
        
        [self setUpAllChildView];
        
    }
    return self;
}

#pragma mark - set
- (void)setInfoDict:(NSDictionary *)infoDict {
    /**
    @{@"heardImage":@"syj_pc_yjfk",
      @"title":@"意见反馈",
      @"rightTitle":@"",
      @"flag":@"yjfk"
      },
     */
    self.imageIcon.image = [UIImage imageNamed:infoDict[@"heardImage"]];
    self.namelab.text = infoDict[@"title"];
    
    
}

#pragma mark - 配置视图
- (void)layoutSubviews{
    [super layoutSubviews];
    [self configFrame];
}

- (void)configFrame{
    self.imageIcon.frame = CGRectMake(39*AutoSizeScaleXX, 64*AutoSizeScaleYY*0.5 - 16*AutoSizeScaleXX*0.5 , 16*AutoSizeScaleXX, 16*AutoSizeScaleXX);
    CGSize nameSize = [self.namelab.text sizeWithAttributes:@{NSFontAttributeName : self.namelab.font}];
    self.namelab.frame = CGRectMake(self.imageIcon.right +13*AutoSizeScaleXX, 0, nameSize.width, self.height);
    
    self.arrowImage.frame = CGRectMake(self.width -13*AutoSizeScaleXX -24*AutoSizeScaleXX, 18*AutoSizeScaleYY, 24*AutoSizeScaleXX, 24*AutoSizeScaleXX);
    
}
- (void)setUpAllChildView{
    self.namelab = [JSLKitFactory jsl_labelWithFrame:CGRectZero text:nil font:REGULAR_FONT(16) textColor:BACK_COLOR textAlignment:NSTextAlignmentLeft SuperView:self.contentView];
    
     self.arrowImage = [JSLKitFactory jsl_imageViewWithFrame:CGRectZero imageName:@"arrow-r" superView:self.contentView];
    
    self.imageIcon = [JSLKitFactory jsl_imageViewWithFrame:CGRectZero imageName:@"" superView:self.contentView];
}

#pragma mark - 创建cell
+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString * ID = @"FBProfileCell";
    id cell = [tableView dequeueReusableCellWithIdentifier:ID ];
    
    if (cell == nil) {
        cell = [[self alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    
    return cell;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}


@end
